module.exports = {
  sendSuccessRespone(req, res, next) {
    res.sendSuccess = (data, code = 200) => {
      res.status(200).send({
        message: "success",
        code,
        data
      })
    }
    next()
  },
  sendErrorRespone(req, res, next) {
    res.sendError = (data, statusCode = 500) => {
      res.status(statusCode).send({
        message: data,
        code: statusCode
      })
    }
    next()
  }
}
